home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of Shareware
/
Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso
/
mac
/
DOS
/
PROGRAMG
/
ZI_123
/
ZINSTALL.DOC
< prev
next >
Wrap
Text File
|
1992-08-20
|
113KB
|
3,291 lines
Z/Install
Version 1.0
(c) Copyright 1992 SpeedSOFT Development
All rights reserved.
July 1st, 1992
The ultimate developer's helper SpeedSOFT Development
TABLE OF CONTENTS PAGE
Chapter 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 - What is Z/Install? . . . . . . . . . . . . . . . . . . . . 4
1.2 - The installation executable . . . . . . . . . . . . . . . 4
1.3 - Archiving files . . . . . . . . . . . . . . . . . . . . . 4
1.4 - Distribution disks . . . . . . . . . . . . . . . . . . . . 4
Chapter 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
A general overview of the script language . . . . . . . . . . . 6
2.1 - How to write a script file . . . . . . . . . . . . . . . . 7
2.2 - Rules of the ZSL compiler . . . . . . . . . . . . . . . . 11
2.3 - Limitations of the ZSL compiler . . . . . . . . . . . . . 12
2.4 - Single-variable modification operators . . . . . . . . . . 12
2.5 - Format control strings . . . . . . . . . . . . . . . . . . 12
2.6 - String codes . . . . . . . . . . . . . . . . . . . . . . . 14
2.7 - Tokens in ZSL . . . . . . . . . . . . . . . . . . . . . . 15
2.8 - The color strings . . . . . . . . . . . . . . . . . . . . 15
2.9 - The Set... functions . . . . . . . . . . . . . . . . . . . 16
2.10 - Global variables . . . . . . . . . . . . . . . . . . . . 17
2.11 - Using the compiler . . . . . . . . . . . . . . . . . . . 17
2.12 - The Precompiling Stage . . . . . . . . . . . . . . . . . 18
2.13 - Final notes . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1 - A general overview of the .ZPK format . . . . . . . . . . 20
3.2 - Command line switches for ZPACK.EXE . . . . . . . . . . . 20
3.3 - Self-extracting archives . . . . . . . . . . . . . . . . . 22
Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1 - Distribution building, Step one . . . . . . . . . . . . . 23
4.2 - Distribution building, Step two . . . . . . . . . . . . . 24
4.3 - What do I do with the script file OPTDist creates? . . . . 24
4.4 - Disadvantages of using OPTDist . . . . . . . . . . . . . . 24
Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Appendix B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
B.1 - The [GROUPS] Section . . . . . . . . . . . . . . . . . . . 47
B.2 - The [FILES] Section . . . . . . . . . . . . . . . . . . . 47
B.3 - The [PATHS] Section . . . . . . . . . . . . . . . . . . . 47
B.4 - The [DISKS] Section . . . . . . . . . . . . . . . . . . . 48
Appendix C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Appendix D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2 Z/Install User's Guide
Chapter 1
Welcome to Z/Install!
Thank you for taking the time to evaluate Z/Install, version 1.0. We hope
you find our product useful, simple to understand, and most of all,
intuitive. Many hours of work have gone into the design of Z/Install, and
more still have been devoted to rigorous testing and benchmarking. One
factor has been paramount in the development of Z/Install: to produce a
system that is powerful and versatile in design and function, with ease of
use that is surpassed by none.
1.1 - What is Z/Install?
--------------------------------------------
Z/Install is a multi-purpose developer's helper. It has three primary
functions: To create an installation program, to archive and store the
developer's software, and to create distribution disk sets. All three
sections of Z/Install use an original Textual User Interface (TUI) with
eye-pleasing VGA support and an online, context-sensitive HyperText help
system, to make sure the user's time is well-spent.
1.2 - The installation executable
--------------------------------------------
Z/Install uses its powerful compiler to read a user-written script file
and produce an installation program. The program contains all the
information about the product that it will install, and requires no
external files to run properly, except those that make up the user's
application.
See Chapter 2 - Writing an installation script file - for a full
explanation on the versatile script language used by Z/Install.
1.3 - Archiving files
--------------------------------------------
Z/Install includes two archiving programs. One is command-line driven,
and the other boasts a windowed user interface. Both of these create and
maintain archives that are placed on the distribution disks and un-
archived by the installation executable. The archivers also compress the
files that are stored, with the result that much less space is required on
the distribution disks. This alone can save the user a great deal of
money on disks. It also provides a method of storing many files in one
single 'pack' - much easier than maintaining tens of distribution files.
See Chapter 3 - The archiving programs - for information about the 'packs'
and the programs that use them.
3 SpeedSOFT Development
1.4 - Distribution disks
--------------------------------------------
While other installation packages force you to create your own
distribution disks, Z/Install provides a totally automated method of
performing the task. OPTDist - our most intuitive program - will create
your distribution disks for you! Not only that - it will format and label
your disks, copy your files, and save you money! OPTDist will read your
distribution files, prompt you for a disk media size, and, using a
sophisticated algorithm, compute the order in which files are placed on
your disks that takes up the least number of disks! It even writes a
script for the installation executable to read that tells it where to find
the files! How's that for automation?
4 Z/Install User's Guide
Chapter 2
Writing an installation script file
This is the most important step in using Z/Install. Although it helps to
have an understanding of a programming language, such as BASIC, it is not
necessary.
A general overview of the script language
--------------------------------------------
(This subchapter is intended for use by beginners to programming.)
Think of the script language as the English language. The verbs in spoken
language are the actions that are taken. In Z/Install's script language,
the verbs are called functions.
Functions, like verbs, can take objects. The objects are the receivers of
the action. In ZSL, the objects are called variables.
Variables are like boxes - they hold things. In ZSL, there are two types
of variables. The first, a string variable, can hold a number of
characters. For instance, a string variable could hold the sentence
"Hello, World!". In ZSL, as in other languages, string variables are
recognised by surrounding quotation marks ("). More on string variables
later.
The second type of variable is an integer, or number, variable. These
types of variables can hold any number from 1 to 65,535.
Variables are used to get user input and store return values from
functions.
The second type of data in ZSL is a constant. A constant is a value which
cannot be changed, such as the number 2. No matter how you look at it,
the number 2 is always equal to 2. Constants and variables can be
interchanged anywhere in the script file with the exception of the left
value in an assignment (the left side of an equals expression).
Variables can be assigned values by using the assignment operator (the
equals sign). The left side of an assignment expression is the variable
that will hold the data computed from the right side. For example:
int x ; Declare an integer
x = 10*5 ; Assign the value of 10*5 (50) to x.
Now, the value stored in 'x' is 50. This next example is invalid:
10 = 10*5 ; Error!
Obviously that can't be correct.
In short, the right side of an assignment expression is computed and
stored in the left side, which must ALWAYS be the name of a variable.
Variables can be assigned the return values of functions. In the next
5 SpeedSOFT Development
example, a variable will be assigned the return value of the function
'FileType':
int fe ; Declare an integer
fe = FileType "NOTEXIST.FIL" ; Check the type of
; NOTEXIST.FIL.
In this example, again, the right side is computed and stored in the
variable on the left. Thus, the integer 'fe' would contain the return
code from the call to FileType. 'Fe' could then be used in an 'If'
statement to branch control to another part of the script file, depending
on the results of the call to FileType.
2.1 - How to write a script file
--------------------------------------------
In general, the script file should follow this format:
A few comments on what the script file installs.
Put in the [disks], [groups], [paths] and [files] sections.
Use the Set... functions to set up your screen.
Declare your variables.
Show some kind of welcome message.
Get the groups the user wants to install.
Get the disk and path the user wants to install to.
Call CheckInstOK.
Call BeginInstall
Show an exit message
The first part of a script file is the information section. This section
contains the information about the application that Z/Install will
install.
The first section is the [DISKS] section. This is used to identify the
different distribution disks and to inform the user which disk to insert.
The format of each line in the [DISKS] section is:
Disk number : Volume label : Descriptive name
The disk number is used in the [FILES] section. Z/Install uses this disk
number to determine the source disk of each file.
The volume label is used to make sure the user inserts the correct disk.
The descriptive name is used in the prompt requesting the user to insert a
new disk. When a disk change is required, the user will see a window with
the following text:
Please insert the disk marked
"Descriptive name"
in the drive.
6 Z/Install User's Guide
The [DISKS] section is mandatory, however, Z/Install will ignore it if the
source drive is a hard disk. In this case, all files are expected to be
located in the current directory on the source hard disk.
An example [DISKS] section is:
[DISKS]
1:Z/Install Disk 1
2:Z/Install Disk 2
[END]
Each of the information sections is terminated with the line "[END]".
Next comes the [GROUPS] section. This section is optional. Suppose your
application were a word processor, and it included utilities like a
spellchecker and a thesaurus. The user can opt to install only the parts
of your application that are wanted. These parts are set up in this
section.
Each line in the [GROUPS] section is formatted as follows:
Group number : Group name : Install default (1 = Yes/0 = No)
The group number is used later in the [FILES] section to determine which
group a file belongs to.
The group name is used to identify the groups to the user. It appears in
the Bar Menu displayed by 'GetInstallGroups' (see Appendix A).
An example
[GROUPS]
1:Main program:1
2:Spellchecker:1
3:Thesaurus:1
4:Printer files:0
[END]
In the above example, the 'Printer files' group will not be installed by
default.
Next, write the [PATHS] section. This section contains the directory tree
that Z/Install will create on the user's disk when installing the
application. The first path is the directory off the root that Z/Install
will create. It is OK to have more than one directory name in this, such
as:
\APPS\WORDPROC\
Each following path name is a directory off of the first directory. For
example, if path number one was "\APPS\WORDPROC\", and path two was
"\SPELL\", the files that are installed to path two would end up in
"\APPS\WORDPROC\SPELL\" on the user's disk.
The [PATHS] section is formatted as follows:
7 SpeedSOFT Development
Path number : Path
The path number is used later in the [FILES] section to tell Z/Install
where to put each file on the destination disk.
[PATHS]
1:\APPS\WORDPROC\
2:\SPELL\
3:\THES\
4:\PRINTER\
[END]
Note: Path number one is accessible with the string variable 'RootDir'.
Last is the [FILES] section. This contains the list of individual files
that your application is made up of. The file list follows a simple
format:
FILENAME.EXT : Path Number : Disk Number : Compressed (1/0) : Group Number
'Path Number' is the number of the path that the file will reside in when
installed.
'Disk Number' is the number of the disk that the file is to be found on.
'Compressed (1/0)' is the number 1 or 0, depending on if the file is a
ZPack archive. If it is, the contents of the archive will be unpacked
into the path, instead of the file itself.
'Group Number' is the number of the group that this file is part of.
Then, the file will only be installed if its group was selected by the
user. If this number is 0, the file will always be installed.
[FILES]
MAIN.ZPK : 1 : 1 : 1 : 1
SPELL.ZPK : 2 : 1 : 1 : 2
THES.ZPK : 3 : 2 : 1 : 3
PRINTER.ZPK : 4 : 2 : 1 : 4
[END]
The next step in the script file is to use the 'Set...' functions to set
up the colors and style of the Installation Program. See 2.9 for
information.
If your script file uses any variables, they should be declared now. This
is the best place to declare them because they are easy to find if they're
always at the top of the script, and they will also be available
throughout the entire script.
It's a good idea to show your welcome screen here. Use the 'Dialog'
function to display some information about your application, and what its
requirements are. An example:
Dialog 0, 0
8 Z/Install User's Guide
@CWelcome to Application v1.0! This program will install Application
@Con your hard disk and help you get started with using it.
EndDialog
Call 'GetInstallGroups' here to ask the user which groups are to be
installed.
Call 'GetInstallationDrive' to determine the destination drive.
Use a dialog to ask the user which path to install to. This is not
mandatory, because Z/Install will default to path number one (as set up in
the [PATHS] section). An example for doing this is:
Dialog 0, 0
@CPlease enter the path in which to install Application:
@ERootDir
EndDialog
See the function 'Dialog' in the Appendix A for information on receiving
input and writing dialogs.
If you have turned off the option to use a hard disk as a source drive,
call 'CheckInstOK' here to confirm that the user is installing from a
floppy disk.
Now, everything is ready to go! Call 'BeginInstall' here to start the
installation.
After the installation is finished, use 'Dialog' again to show an exit
message, and call 'ExitScript' to exit Z/Install.
9 SpeedSOFT Development
2.2 - Rules of the ZSL compiler
--------------------------------------------
- Strings are declared with the STR function. Integers are
declared with the INT function.
- The ZSL interpreter has an expression evaluator that supports
the following operators: ()*/+-=. It uses the standard BEDMAS
rules to evaluate the expressions. For example:
x = (10*(5+1))/(20-10)
- Variables may be used in place of constants almost anywhere in
the script file. For example:
x = (10*b)+y
- Return values from functions don't have to be stored in a
variable. For example, GetChoice returns a string variable, but
in this instance, we just wait for any key:
GetChoice "" ; Wait for any key, we don't care which.
- Variables types are NOT interchangeable. If a function returns
a string variable, the variable on the left side of the
expression MUST be a string variable, and vice-versa. The same
goes for function parameters.
- Variables and labels (see function LABEL) cannot be declared
inside an 'If' loop.
- ZSL is case-insensitive. For example, calls to 'SetDialogColor'
and 'SETDIALOGCOLOR' would have the same effect.
10 Z/Install User's Guide
2.3 - Limitations of the ZSL compiler
--------------------------------------------
- The compiled data in the script file cannot exceed 64k. This is
not a problem since a dense, 500 line script file only produces
about 7k of compiled data.
- Strings can be a maximum of 255 characters long.
- There can only be one expression on each line.
- Lines are commented with semicolons. As soon as the compiler
intercepts a semicolon that is outside quotation marks, it
ignores the rest of the line.
- There can be up to 50 integer and 50 string variables in a
script file.
- The maximum line length is 255 characters.
2.4 - Single-variable modification operators
--------------------------------------------
These modification operators are used for single-variable integer
arithmetic:
Modifier Description Sample
--------------------------------------------
+= Plus equals x+=5
-= Minus equals x-=5
++ Increment by one x++
-- Decrement by one x--
*= Times equals x*=2
/= Divide equals x/=2
&= Bitwise AND equals x&=128
|= Bitwise OR equals x|=128
Therefore,
x += 5 is the same as x = x + 5
x /= 4 x = x / 4
x ++ x = x + 1
and so on. This is just a shorthand method to save time and space.
2.5 - Format control strings
--------------------------------------------
In ZSL, as in C, there is a facility for creating formatted strings. It
is used this way:
variablename(format specifier)
11 SpeedSOFT Development
The format specifier is arranged as follows:
[Optional Direction]
[Optional fill character]
Minimum number of characters
1. Direction
This comes before anything else. The default justification is Right
justification, which pads on the left:
John Doe
Gale Jones
^^^^^^^^^^^^^^^^^^ = Left padded
If you wish to have left justification, then you must place the '-'
character before the rest of the format specifier.
2. Fill character
This is also optional. If you have integers to be displayed, and you want
to fill the empty digits with, say, a '0' character, your format specifier
would look like this:
variablename(030)
The first character in the format specifier is the fill character. Note:
You cannot use positive numbers for your fill character if you are
justifying an integer! Fill characters only work on right-justified text
(they will just be ignored on left-justified text).
3. Number of characters
This is the minimum number of characters that will be displayed. If the
length of the variable is less than this number, it will be padded with
your fill character. If the variable to be displayed is longer than this
number, it will be truncated to fit it. Look at the following example:
str name = "John Doe"
str formattedname
formattedname = name(20)
'formattedname' would now contain:
John Doe
^^^^^^^^^^^^^^^^^^^ = 20 characters.
12 Z/Install User's Guide
If you were to put in:
formattedname = name(-20)
It would contain:
John Doe
^^^^^^^^^^^^^^^^^^^ = 20 characters.
Some examples:
An integer, padded on the left with spaces to make a MINIMUM of 10
characters: my_int(10) (The default padding character is a space).
A string, padded on the left with pound signs to make a MINIMUM of 15
characters: my_str(#15)
A string, padded on the right with stars to make a minimum of 20
characters: my_str(-*20)
Format control strings can also be stacked, as follows:
str name = "George"
str date = "07/01/92"
str time = "10:34:42"
str formatted = name(-20), " - ", date(-8), " - ", time(-8), "\n"
Note: In 'stacked' format strings, each variable/constant is also
separated with a comma, just like function parameters.
From the above example, the string 'formatted' would now contain:
"George - 07/01/92 - 10:34:42 (linefeed)"
^^^^^^^^^^^^^^^^^^^^ = 20 characters, as specified with
"name(-20)". Don't forget that putting the
minus sign before the minimum number of
characters left-justifies the text.
2.6 - String codes
--------------------------------------------
Z/Install allows you to embed certain control codes in your strings.
These control codes make it easier for you to put special characters, such
as linefeeds and tabs, into your script. These codes begin with the
backslash character (\), and are followed by one or more control
characters. This is the table of codes:
13 SpeedSOFT Development
What you write What gets put in
--------------------------------------------
\\ One backslash character
\t Tab (ASCII 9)
\f Formfeed (ASCII 12)
\n Linefeed (ASCII 10)
\r Carriage Return (ASCII 13)
\xXX Hexadecimal XX
\a Bell (ASCII 7)
\b Backspace (ASCII 8)
Example:
str my_str = "$\x04\agy\b"
as seen by the compiler, would be: $(HEX 04)(BELL)gy(BACKSPACE)
2.7 - Tokens in ZSL
--------------------------------------------
What it is Example Case Sensitive? What it does
--------------------------------------------
Function FileType N Performs actions
Operators =, +=, > N Compares/Modifies Data
Labels my_label N Used for GOTO/GOSUB
Operands
Integers
Variables my_int N Stores data
Decimal Const 1, 300, 20
Hexadec. Const 0x100, 0xFF N
Char. Const ')' 'R' Y
Strings
Variables my_str N Stores data
String Const "Hi", "Bye" Y
2.8 - The color strings
--------------------------------------------
No more messing around with attribute bytes - Z/Install has a color string
parser built in! It's as easy as it sounds; just type in the color you
want. These strings are used for the Set...Color functions, and they
follow this format:
[Bright]Color<On>[Bright]Color
Where 'Color' is:
Black Blue
Green Cyan
Red Magenta
Brown White
If you put 'Bright' before the 'Color', it will be a high-intensity
14 Z/Install User's Guide
version of the darker color. Brown turns to yellow. ColorStrings are
case-insensitive.
Example: SetDialogColor BrightBrownOnBlue
Note: If you specify a 'Bright' background color, you should call
UseHighIntensityBGColors. Otherwise, the background won't
change, and the foreground will blink. This is a BIOS
limitation.
2.9 - The Set... functions
--------------------------------------------
ZSL uses these Set... functions to control its screen and input routines:
Function Parameter Sets what?
--------------------------------------------
SetBackColor ColorString Background color
SetBackChar ASCII 1-255 Background fill char
SetDialogColor ColorString Dialog color
SetDialogStyle StyleString* Dialog border style
SetPrintColor ColorString Dialog text color
SetExitMessage 1-80 char str Text displayed at exit
SetInputColor ColorString Color for user input
SetInputFill ASCII 1-255 Fills empty space in input
SetBarNormalColor ColorString BarMenu unselected color
SetBarHighColor ColorString BarMenu selected color
SetBarCharColor ColorString BarMenu hotkey color
SetDialogShadows On/Off Dialog shadows on/off
SetWarnColor ColorString Error/Warning dialog color
SetWarnTxtColor ColorString Error/Warning text color
SetExplode ExplString* Exploding windows
SetExplodeSnd On/Off Exploding sound
SetExplodeType 1 or 2 Exploding type
For SetExplodeType, 1 sets slow, smooth explosions, and 2 sets
faster, explosions.
* StyleString is: Single, Double, Thick, or None.
* ExplString is : All, Dialog_Only, Dialog_Warn, or None. Sets
explode for windows, only dialogs, dialogs and warnings, or no
explosions, respectively.
The Set... functions should all be called after the information sections
and before any other function calls.
Note: If the user's video display is monochrome, the installation
program will set its colors to a hard-coded default for black-
and-white screens. This way, the monochrome users will always
be able to see the screens properly.
2.10 - Global variables
15 SpeedSOFT Development
--------------------------------------------
Z/Install has 20 global variables, most of which are used for system auto-
detection. These variables can be accessed anywhere in the script file.
They are:
Name Type [Int/Str] Description
--------------------------------------------
EgaVga Int 1 if EGA, 2 if VGA, 0 if CGA
ExtendedMemory Int Int 15h memory in kbytes
XMSMemory Int Raw XMS memory in kbytes
Joystick Int 1 if joystick installed
MathCPU Int 1 if coprocessor installed
ConvMemory Int Base conventional memory in kbytes
EMSMemory Int EMS memory in kbytes
ANSISYS Int 1 if ANSI.SYS (or equivalent) installed
OSMinor Int DOS version number (major)
OSMajor Int DOS version number (minor)
BWColor Int 1 if color, 0 if black and white
SourceType Int Source disk size (K) - 360, 720, 1200, 1440
NumArgs Int Number of command-line arguments
FileHandles Int Number of DOS file handles available
Buffers Int Number of DOS buffers available
ProcessorType Str "186", "286", "386", "486"
InstalledOK Int See note
Instdrv Str Drive letter of the destination disk
Rootdir Str Root dir on the destination disk
NeededSpace Int Space free needed to install*
* This variable is automatically set. If, for any reason, it needs
to be changed, make sure it is set to the right value.
Note: The integer variable 'InstalledOK' gets set after calling
'BeginInstall'. If the user aborted the installation,
'InstalledOK' gets set to 0. Otherwise it is set to 1.
2.11 - Using the compiler
--------------------------------------------
The compiler is 'ZINSTALL.EXE'. It has a simple command line interface:
The first parameter is the name of the script file to compile. The second
is the name of the output file to create.
Suppose you had written a script file called DEMO.ZSL. To compile it, you
would enter the following at the DOS prompt:
C:\ZINSTALL> zinstall demo
This would produce DEMO.EXE, assuming there are no errors during the
compilation. Note that the extension of the script file (.ZSL) is not
specified. This is because the compiler assumes the .ZSL extension if no
other extension is provided.
16 Z/Install User's Guide
The default output filename is 'filename.EXE', where 'filename' is the
name of the script that is compiled. If you want to change the name of
the output file, simply specify it on the second parameter. For example:
C:\ZINSTALL> zinstall demo install
This example would produce INSTALL.EXE. The extension of the output file
will always be '.EXE', even if another extension is provided.
The compiler will make three passes on the script file. The first pass is
called the 'precompiling stage'. See Chapter 2.12 for information on this
important phase. The second and third passes translate the script file
into binary information that the installation executable can interpret.
If there are any errors or warnings during the compilation, they will be
written to the file 'ZINSTALL.LOG', unless the first parameter passed to
Z/Install is /x. See Appendix C for a list of all the errors that can
occur.
2.12 - The Precompiling Stage
--------------------------------------------
During this important stage, Z/Install looks for certain instructions in
the script file called precompiler directives. These directives are used
to instruct Z/Install when it interprets the script.
The directives are identified with a preceding pound sign, '#'. This is
so the precompiler can easily and quickly tell them apart from other
script file commands.
In Version 1.0, there are only two directives. They are:
#include filename This directive instructs the compiler to include the
contents of 'filename' in the script file. 'Filename'
cannot have any precompiler directives in it.
#end This directive instructs the compiler to stop reading
the script file. Everything in the script after this
directive will be ignored.
Precompiler directives, like all other keywords in ZSL, are case-
insensitive.
2.13 - Final notes
--------------------------------------------
Here are a few pointers to get you started with ZSL:
- Comment your scripts. You'll hate the feeling of asking, "Why did
I put that in?". You'll hate it even more when you take it out and
your script doesn't run!
- Test your work. Make sure your script runs smoothly on more than
17 SpeedSOFT Development
one computer.
- If your script modifies AUTOEXEC.BAT and/or CONFIG.SYS, make sure
the script asks the user if they want direct modifications, or if
they want the installation program to create a file with the
recommended changes. Users HATE it when programs make changes to
their boot files without their knowledge.
- Call us with any problems. See Appendix D for information.
You are now ready to write your installation script! Appendix A lists all
the script commands in alphabetical order.
18 Z/Install User's Guide
Chapter 3
The Archiving Programs
Z/Install is packaged with two versions of its archive program, ZPack. One
version is used from the command line (it's the one we'll discuss here),
and the other has a menu-driven interface. Both produce the same type of
archive, the .ZPK format. You'll find both programs in the ZPACK
subdirectory. They are ZPACK.EXE and ZPMENU.EXE.
3.1 - A general overview of the .ZPK format
--------------------------------------------
(This is for those who are interested in the technical aspects of ZPack,
and is by no means required reading)
Each archive file begins with a signature comprised of the following
characters: 1,ZPK,1. This is used to determine if the file really is of
the .ZPK format.
Next, the files come in sequence, with a header before each. The header
simply stores information about the file, such as the CRC-32 value and the
file date/time.
The files are stored in no particular order. There is a maximum of 65,535
files per archive, and no limit on the size of the archive or the files
inside it. The files are stored without a path name.
3.2 - Command line switches for ZPACK.EXE
--------------------------------------------
ZPack has a relatively simple command line syntax. It is as follows:
ZPACK <action> [/options] <filename[.ZPK]> [filenames...]
The parsing syntax for the command line is:
[] - Anything enclosed in these is optional in most cases. For
example, the [filenames...] parameter is not required to view the
contents of an archive, but is definitely required to add or delete
files from the archive.
<> - Parameters enclosed in these are mandatory and cannot be left
out. Doing so will cause ZPack to report an error.
...- Means one or more of the same type of parameter may be used.
This means you can have multiple filenames/wildcards in the
[filenames] parameter, separated with spaces.
Note: When specifying the archive name, it is not necessary to put in
the extension (.ZPK). If you DO put an in extension, however,
ZPack will look for the specified file instead of appending
.ZPK.
The parameter <action> is the function that you want ZPack to perform. It
19 SpeedSOFT Development
can be one of the following:
A - Add files (create archive). If the archive file specified is
missing, it will be created. Wildcards are allowed in the
[filenames...] parameter.
Sample: zpack a program *.exe *.dat
D - Delete files. The files specified in [filenames...] will be
deleted from the archive. Wildcards are allowed. ZPack will prompt
you to Save the Changes (Y/N) after it deletes the files, so you have
a chance to make a mistake.
Sample: zpack d program *.exe *.dat
F - Freshen files. This is a powerful command. ZPack will
sequentially read the file records in the archive and match the date
and time of each one to the date and time of the same files on the
disk drive. If the file on the drive is newer than the file in the
archive, the archived file will be updated with the new data. The
[filenames...] parameter is ignored with this action.
Sample: zpack f program
L - List files. This will give a summary of the files in the
specified archive. Wildcards are allowed on the [filenames...]
parameter.
Sample: zpack l program *.exe
X - Extract pack. This will extract the files from the archive into
the current drive/directory. If the file already exists, you will be
prompted to overwrite it or not. Wildcards are allowed on the
[filenames...] parameter.
Sample: zpack x program *.dat
S - Make SFX. This will convert the specified archive into a self-
extracting .EXE file. Please see section 3.3 for more information
about Self Extracting Archives.
Sample: zpack s program
J - Make Junior-SFX. This is the same as action 's', except it
produces a smaller .EXE. Although you save about 9k in size, the
resulting .EXE does not have as many features as a normal SFX.
Sample: zpack j program
The optional parameter [/options] can be one or more of the following:
O - Overwrite without prompting. This option will force ZPack to
overwrite any existing files without prompting when extracting an
archive. Note: Use this with caution, as it may result in accidental
20 Z/Install User's Guide
loss of data!
Sample: zpack x /o program
W<disk>- Assign work drive. This applies to all actions. Normally,
<disk> would be a RAM disk. ZPack uses temporary files and a great
deal of disk activity can result when performing archive operations.
Set this to the fastest disk on your system.
Sample: zpack a /wd program
3.3 - Self-extracting archives
--------------------------------------------
ZPack has two options to convert normal archives into self-extracting
archives (SFX). SFXs are run from the command line, like any other
executable program. When they are run, they automatically decompress the
files that are stored inside them. There are two versions of the ZPack
SFX programs; the regular and the junior size.
The regular SFX adds about 17000 bytes to the size of the archive. It
also has two command-line options. They are:
O - Overwrite any existing files without prompting. If this option
is specified, the SFX will extract the files in the archive without
prompting whether or not to overwrite any existing files. The
default is 'do' prompt.
L - List the files in the archive. This displays the contents of the
archive on the screen.
The format for the command line options is:
EXEFILE <option>
If the archive has a file called 'COMMENT.PAK' inside it, the SFX will
read this file and display its contents after the archive has been
extracted. 'COMMENT.PAK' can also have a special code in it to tell the
SFX to run a program after it has finished extracting the archive. The
code is:
*RUN EXENAME.EXE
Where EXENAME.EXE is the name of the program you want the SFX to run. This
is great for authors who distribute their programs via Bulletin Board
Systems, because they can instruct the SFX to run their installation
program after it extracts the files.
The other form of SFX is the junior SFX. It doesn't have any command line
options, and it will always prompt to overwrite any files it finds on the
destination disk. The junior SFX will ignore COMMENT.PAK. It adds about
9000 bytes to the size of the archive.
21 SpeedSOFT Development
Chapter 4
Two easy steps to build distribution disks
Note: Familiarize yourself with Chapter 2 before reading this chapter.
4.1 - Distribution building, Step one
--------------------------------------------
With the power and ease of OPTDist at your command, all you need are two
steps (that's right, just two steps) to build a master diskette set. The
first step is the only one that requires any real work, since step two is
simply 'Run OPTDist'! Step one involves writing a special control file
for OPTDist to read and parse. This control file contains the paths and
files on your hard disk (on your development computer) that make up your
application. It follows a simple format:
;
; Lines with a semicolon as the FIRST character are ignored.
;
; OPTDist control file for Z/Install.
;
*PATH C:\TC\ZINSTALL\DIST
;
; That's the path. All the filenames following this (and up until the
; next *PATH statement) are expected to be found in this path.
;
; The file list follows a special format:
;
; FILENAME.EXT :Path # :<D> :Compressed [1/0] :Group #
;
; Where: Path # - Is the path number, defined in [paths], that
; this file (or its contents, if it's an archive)
; will reside on the user's disk after being
; installed.
;
; <D> - Is the actual string <D>. This gets replaced with ; the
disk number the file is on when OPTDist is run.
;
; Compressed [1/0] - Is 1 or 0, depending on if the file is
; compressed using ZPack or not.
;
; Group # - Is the group number, defined in [groups], that
; this file is part of (If this is zero, this file
; will ALWAYS be installed).
;
ZINSTALL.ZPK :0 :<D> :1 :1
OPTDIST.ZPK :1 :<D> :1 :2
DOCS.ZPK :2 :<D> :1 :3
PACKARC.ZPK :3 :<D> :1 :4
SAMPLES.ZPK :4 :<D> :1 :5
FONTS.ZPK :5 :<D> :1 :6
This is the actual OPTDist control file used to make Z/Install's
22 Z/Install User's Guide
distribution disk set. There is only one *PATH statement because we packed
all of our distribution archives in this directory to avoid cluttering up
our development area.
Please note that the file extension for the OPTDist control files must be
.OD.
4.2 - Distribution building, Step two
--------------------------------------------
Now, all you need to do is run OPTDist. There is online documentation for
OPTDist, so we won't discuss its commands and features in this manual.
(Press F1 once you're in OPTDist to bring up the help system.)
4.3 - What do I do with the script file OPTDist creates?
--------------------------------------------
This is the easiest part! After the [paths] and [groups] sections in your
script file, all you have to do is type the line:
#include SCRNAME.OPT
Where SCRNAME.OPT is the name of the file that OPTDist created after you
ran it. The installation executable will then determine where to find the
files at runtime.
4.4 - Disadvantages of using OPTDist
--------------------------------------------
Some developers like to have their distribution disks organized by
content, such as 'Spellchecker' and 'Thesaurus/Printer program'. If you
use OPTDist, the script file it creates will have a [DISKS] information
section in it. You may edit the descriptions of the disks in this script
(See Appendix B), but not the order. In other words, the disks will have
to be named this way:
ApplicationName Disk 1
ApplicationName Disk 2
etc...
They cannot be arranged by content.
23 SpeedSOFT Development
Appendix A
This Appendix discusses the use of Z/Install's script functions. Return
values from functions can be stored in string or integer variables.
Function parameters can be string or integer constants and variables, and
are separated with commas. Any extra parameters will be ignored.
This is the general outline of a function description:
Function Name Return Type
--------------------------------------------
Parms: FunctionName <VARTYPE parm>, ...
VARTYPE can be:
STRVAR - A string variable only.
STR - A string variable/constant.
BOOL - A boolean value: =, >=, !=, <=, <, >
INTVAR - An integer variable only.
INT - An integer variable/constant.
ANY - Any string/integer variable/constant.
LABEL - A label defined with LABEL.
COLOR - A ColorString.
ONOFF - "On" or "Off".
FORMAT - A formatted control string OR a string
variable/constant.
Returns: (The value it returns, if any)
Desc: (A long description)
Example: (A Sample usage)
Some functions return an 'Escape Integer'. The function 'SetEscapeType'
is used to tell Z/Install how to handle the user pressing <ESC>. If the
user presses <ESC>, Z/Install will automatically exit OR the return value
from these functions will be 0, depending on the call to 'SetEscapeType'.
The default is to let Z/Install handle the <ESC> key by asking the user if
they want to exit.
Some functions can be repositioned with the 'At' command. If the function
call has "@(x,y)" on its end, where 'x' is the column and 'y' is the row,
the function's output will start at x,y on the screen. If 'x' is zero,
the output will be centered horizontally. If 'y' is zero, the output will
be centered vertically. For example:
GetInstallationDrive @(0,4) ; Start on line 4, centered horizontally.
GetInstallationDrive @(3,4) ; Start on column three, line 4.
24 Z/Install User's Guide
AddAuto None
--------------------------------------------
Parms: AddAuto <FORMAT text>
Returns: None
Desc: Adds 'text' to AUTOEXEC.BAT. It looks in the root directory of
the destination drive.
Example: AddAuto "ECHO OFF"
AddConfig None
--------------------------------------------
Parms: AddConfig <FORMAT text>
Returns: None
Desc: Adds 'text' to CONFIG.SYS. It looks in the root directory of
the destination drive.
Example: AddConfig "DEVICE=ANSI.SYS"
BarMenu None
--------------------------------------------
Parms: BarMenu <INTVAR selection>, <INT len>, <INT start>, <INT
removewin>
Returns: None
Desc: Places a bar menu on the screen and lets the user make a
selection from a list of choices.
'Selection' is the name of the integer variable to store the
user's choice in.
'Len' is the minimum length of each bar. This is usually set to
40.
'Start' is the selection number to start on when the bar menu is
first called.
If 'removewin' is non-zero, the bar menu will be removed from
the screen once the user makes a selection.
If there are more than 10 selections in the menu, it will scroll
after the user presses the down key on the last visible
selection. The Page Up, Page Down, Home, End, and Up and Down
arrow keys can be used to navigate the menu. If <ESC> is
pressed, 'selection' is set to 0. If <ENTER> is pressed,
'selection' is set to the currently highlighted choice, the
(Function reference continues) 25 SpeedSOFT Development
first being 1.
Choices for the barmenu are defined after the actual call. When
the user moves to a different selection, the short description
that is specified (if any) will be shown.
The bar menu is automatically centered on the screen. This can
be overridden with the 'At' command.
Example: BarMenu Selection, 40, 1, 1
Begin Installation
:This option starts the installation.
Choose Installation Groups
:This option lets you choose which groups you want to
: install.
Toggle Overwrite [Current: %overwrite%]
:Toggle overwrite without prompting.
EndBarMenu
Everything starting with a colon AFTER the selection will be
displayed when the user moves to that selection. The description
will be in a window that starts on the line specified with the
function 'SetDescLine'.
See the example in BARMENU.ZSL.
BeginInstall Int
--------------------------------------------
Parms: None
Returns: Escape Integer: 1 - The installation was un-interrupted
0 - The user aborted the installation
Desc: Begins the installation process, unpacking files and copying
them to the destination disk. Disk space is checked before the
process begins and an error is issued if there is not enough.
Example: BeginInstall
ChDir Int
--------------------------------------------
Parms: ChDir <FORMAT dir>
Returns: Integer: 1 Changed to directory successfully
0 Couldn't change directory (it probably
doesn't exist).
Desc: Changes to the directory specified in 'dir'.
Example: ChDir "C:\\ZINSTALL"
(Function reference continues) 26
Z/Install User's Guide
(Function reference continues) 27 SpeedSOFT Development
CheckInstallOK None
--------------------------------------------
Parms: None
Returns: None
Desc: Checks that the following conditions are met:
(a) the user is installing from a floppy drive, and
(b) there is enough space on the destination disk.
If the conditions stated are not met, a window will appear on
the screen explaining the error to the user, and a possible
solution to the problem. The installation will then abort.
You can set whether or not hard disk source installation is
allowed with SetAllowFixedSrc. It's a good idea to call
CheckInstallOK AFTER the user selects the groups and the
destination disk, and BEFORE calling BeginInstall.
Example: CheckInstallOK
CloseFile None
--------------------------------------------
Parms: None
Returns: None
Desc: Closes the file previously opened with OpenFile.
Example: OpenFile "RUNME.BAT"
WriteFile "CD\\" Rootdir
WriteFile "ZINSTALL.EXE"
CloseFile
ClrScr None
--------------------------------------------
Parms: None
Returns: None
Desc: Fills the text screen with the character and attribute specified
with the SetBackChar and SetBackColor functions.
Example: ClrScr
Copy Int
--------------------------------------------
Parms: Copy <STR src>, <STR dest>
(Function reference continues) 28
Z/Install User's Guide
Returns: Escape Integer: 1 - The copy succeeded
2 - The copy failed: not enough destination space
0 - User aborted copy
Desc: Copies the file 'src' to 'dest'. A window is popped up on the
screen with a graph to show percentage completion. Z/Install
tries to allocate 64k or memory for the copy buffer. If that
fails, it keeps decreasing the size of the buffer by 8k and
tries again until there is enough memory to allocate it.
Example: Copy "FILE1", "FILE2"
Delete Int
--------------------------------------------
Parms: Delete <FORMAT filename>
Returns: Integer: 1 - File deleted OK
0 - File could not be deleted
Desc: Deletes the file 'filename' from the disk. The file is deleted
regardless of its attributes (Hidden and System files are
deleted too). 'Filename' can contain wildcards.
Example: Delete "TEMP.FIL"
Dialog Int
--------------------------------------------
Parms: Dialog <INT forcelen>, <INT keep>
Returns: Escape Integer: 1 - The user didn't press <ES í'( Z/Install
Version 1.0
(c) Copyright 1992 SpeedSOFT Development
deleted too). 'Filename' can contain wildcards. later ∞X FILES] ∞X ! Example: Delete "TEMP.FIL" put